package com.senlingspace.web.controller.pos;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.senlingspace.system.domain.vo.SlkjTeamEqumentVo;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.senlingspace.common.annotation.Log;
import com.senlingspace.common.core.controller.BaseController;
import com.senlingspace.common.core.domain.AjaxResult;
import com.senlingspace.common.enums.BusinessType;
import com.senlingspace.system.domain.SlkjTeamEqument;
import com.senlingspace.system.service.ISlkjTeamEqumentService;
import com.senlingspace.common.core.page.TableDataInfo;

/**
 * 设备组队关联Controller
 * 
 * @author SenlingSpace
 * @date 2024-08-21
 */
@RestController
@RequestMapping("/system/equment")
public class SlkjTeamEqumentController extends BaseController
{
    @Autowired
    private ISlkjTeamEqumentService slkjTeamEqumentService;


    /**
     * 查询设备组队关联列表
     */
    @PreAuthorize("@ss.hasPermi('system:equment:list')")
    @GetMapping("/list")
    public TableDataInfo list(SlkjTeamEqument slkjTeamEqument)
    {
        List<SlkjTeamEqument> list = slkjTeamEqumentService.selectSlkjTeamEqumentList(slkjTeamEqument);
        return getDataTable(list);
    }

//    /**
//     * 导出设备组队关联列表
//     */
//    @PreAuthorize("@ss.hasPermi('system:equment:export')")
//    @Log(title = "设备组队关联", businessType = BusinessType.EXPORT)
//    @PostMapping("/export")
//    public void export(HttpServletResponse response, SlkjTeamEqument slkjTeamEqument)
//    {
//        List<SlkjTeamEqument> list = slkjTeamEqumentService.selectSlkjTeamEqumentList(slkjTeamEqument);
//        ExcelUtil<SlkjTeamEqument> util = new ExcelUtil<SlkjTeamEqument>(SlkjTeamEqument.class);
//        util.exportExcel(response, list, "设备组队关联数据");
//    }

    /**
     * 获取设备组队关联详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:equment:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(slkjTeamEqumentService.selectSlkjTeamEqumentById(id));
    }

    /**
     * 新增设备组队关联
     */
    @PreAuthorize("@ss.hasPermi('system:equment:add')")
    @Log(title = "设备组队关联", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SlkjTeamEqument slkjTeamEqument)
    {
        return toAjax(slkjTeamEqumentService.insertSlkjTeamEqument(slkjTeamEqument));
    }

    /**
     * 修改设备组队关联
     */
    @PreAuthorize("@ss.hasPermi('system:equment:edit')")
    @Log(title = "设备组队关联", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SlkjTeamEqument slkjTeamEqument)
    {
        return toAjax(slkjTeamEqumentService.updateSlkjTeamEqument(slkjTeamEqument));
    }

    /**
     * 删除设备组队关联
     */
    @PreAuthorize("@ss.hasPermi('system:equment:remove')")
    @Log(title = "设备组队关联", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(slkjTeamEqumentService.deleteSlkjTeamEqumentByIds(ids));
    }
}
